package com.gs.xbinfomytest.util;

import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;

import javax.servlet.http.HttpServletRequest;

/**
 * @Created : IntelliJ IDEA.
 * @ProjectName: xbinfomytest
 * @Package: com.gs.xbinfomytest.util
 * @Author: guoshuai
 * @CreateDate: 2019/8/23 9:38
 * @Description: java类的作用描述
 * @Vsersion: 1.0
 */
public class HttpContextUtils {

 public static HttpServletRequest getHttpServletRequest(){
     RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
     //从获取RequestAttributes中获取HttpServletRequest的信息
     HttpServletRequest request = (HttpServletRequest) requestAttributes.resolveReference(RequestAttributes.REFERENCE_REQUEST);
     return request;
 }


}
